﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="Inovout.YunYao.Common"
				           namespace="Inovout.YunYao.Models" >
  <class name="BaseLocation" table="Common_Location" discriminator-value="-1">
    <id name="Id" access="field.camelcase"
        column="LocationId" type="Int32">
      <generator class="native" />
    </id>
    <!--
      discriminator一定在property,set,bag等上面
      若type不非String，class中的discriminator-value必须设定一个值
    -->
    <discriminator column="IsRoom" type="Int16"/>
    <property name="Name" />
    <property name="ZoneCode" type="Int64" />
    <property name="ScopeCode" />
    <many-to-one name="Parent" column="ParentId" class="Location" />
    <property name="CreatedTime"  access="field.camelcase" />
    <property name="CreatedUserName"  access="field.camelcase"/>
    <property name="ModifiedTime"  access="field.camelcase"/>
    <property name="ModifiedUserName"  access="field.camelcase"/>
    <property name="AccessedTime"  access="field.camelcase"/>
    <property name="AccessedUserName"  access="field.camelcase"/>
    <property name="Memo" />
    <property name="IsInvalid" />
    <subclass name="Location" discriminator-value="0">
      <set name="Children" cascade="save-update">
        <key column="ParentId" />
        <one-to-many class="BaseLocation" />
      </set>
    </subclass>
    <subclass name="RoomLocation" discriminator-value="1">
      <property name="IsMoveable" />
    </subclass>
  </class>
</hibernate-mapping>


